/**
 * Copyright (c) 2011 Nokia Corporation.
 */

// Own header
#include "accountitem.h"

// Harmattan includes
#include <Accounts/Account>
#include <Accounts/Manager>

using namespace Accounts;


/*!
  \class AccountItem
  \brief TODO
*/


/*!
  Constructor.
*/
AccountItem::AccountItem(QDeclarativeItem *parent)
    : QDeclarativeItem(parent),
      m_account(0),
      m_manager(0)
{
    setFlag(QGraphicsItem::ItemHasNoContents, true); // Not a visual item
    m_manager = new Manager(this);
}


/*!
  Destructor.
*/
AccountItem::~AccountItem()
{

}


/*!
*/
bool AccountItem::setAccount(const quint32 &id)
{
    Account *account = m_manager->account(id);

    if (account) {
        delete m_account;
        m_account = account;
        return true;
    }

    return false;
}


QML_DECLARE_TYPE(AccountItem)

// End of file.
